# -*- coding: utf-8 -*-
# __init__.py create by kumiler
# on 2022/10/26 9:50
# desc
from datetime import timedelta
from utils.operators.cluster_for_spark_sql_operator import SparkSqlOperator
from spmi.ods.mysql.spmi.spmi_transfer_change_fee_bill import spmi_ods__spmi_transfer_change_fee_bill


spmi_dwd__dwd_spmi_transfer_change_fee_bill_base_dt= SparkSqlOperator(
    task_id='spmi_dwd__dwd_spmi_transfer_change_fee_bill_base_dt',
    email=['lukunming@jtexpress.com','yl_bigdata@yl-scm.com'],
    master='yarn',
    name='spmi_dwd__dwd_spmi_transfer_change_fee_bill_base_dt_{{ execution_date | date_add(1) | cst_ds }}',
    sql='spmi/dwd/spmi/dwd_spmi_transfer_change_fee_bill_base_dt/execute.sql',
    pool_slots=2,
    driver_cores=2,
    driver_memory='8G',
    executor_cores=4,
    executor_memory='8G',
    num_executors=20,
    conf={'spark.dynamicAllocation.enabled'                  : 'true',
          'spark.shuffle.service.enabled'                    : 'true',
          'spark.dynamicAllocation.maxExecutors'             : 50,
          'spark.dynamicAllocation.cachedExecutorIdleTimeout': 30,
          'spark.sql.sources.partitionOverwriteMode'         : 'dynamic',
          'spark.executor.memoryOverhead'                    : '1G',
          'spark.yarn.maxAppAttempts'                        : 1,
          'spark.sql.shuffle.partitions': 800
          },
    hiveconf={'hive.exec.dynamic.partition'             : 'true',  # 动态分区
              'hive.exec.dynamic.partition.mode'        : 'nonstrict',
              'hive.exec.max.dynamic.partitions'        : 300,  # 最大分区
              'hive.exec.max.dynamic.partitions.pernode': 300,  # 最大分区
              },
    yarn_queue='pro',
    execution_timeout=timedelta(minutes=120),
    retries=0,
)

spmi_dwd__dwd_spmi_transfer_change_fee_bill_base_dt << spmi_ods__spmi_transfer_change_fee_bill